package com.burgeon.backend.EnterpriseWeChat.controller;

import com.burgeon.backend.EnterpriseWeChat.entity.*;
import com.burgeon.backend.EnterpriseWeChat.service.EWStoredValueService;
import com.burgeon.backend.EnterpriseWeChat.service.GtasksService;
import com.burgeon.backend.stsutil.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

@RestController
@CrossOrigin
@RequestMapping("ewapp/gtasks")
public class EWGtasksController extends EWBaseController {
    @Autowired
    private GtasksService gtasksService;
    @Autowired
    private EWStoredValueService ewStoredValueService;

    /**
     * 生日邀约
     * @return
     */
    @RequestMapping("GetBirthdayVip")
    public ResponseResult<BirthdayVip> GetBirthdayVip(String token, String empId, String type, int page){
        BirthdayVip data = gtasksService.GetBirthdayVip(token, empId,type,page);
        return new ResponseResult<>(SUCCESS,data);
    }

    /**
     * 长期未消费
     * @param token
     * @param empId
     * @return
     */
    @RequestMapping("GetDormantVip")
    public ResponseResult<BirthdayVip> GetDormantVip(String token, String empId, int page, String type){
        BirthdayVip data = gtasksService.GetDormantVip(token, empId,page,type);
        return new ResponseResult<>(SUCCESS,data);
    }

    /**
     * 试衣单数据
     * @param token
     * @param empId
     * @return
     */
    @RequestMapping("GetFittingRate")
    public ResponseResult<Fitting> GetFittingRate(String token, String empId){
        Fitting data = gtasksService.GetFittingRate(token, empId);
        return new ResponseResult<>(SUCCESS,data);
    }

    /**
     * 试衣单列表数据
     * @param token
     * @param empId
     * @param returnState
     * @return
     */
    @RequestMapping("GetFittingVip")
    public ResponseResult<ArrayList<FittingVip>> GetFittingVip(String token, String empId, String returnState){
        ArrayList<FittingVip> data = gtasksService.GetFittingVip(token, empId,returnState);
        return new ResponseResult<>(SUCCESS,data);
    }

    /**
     * 试衣单明细
     * @param token
     * @param fittingId
     * @return
     */
    @RequestMapping("GetFittingItem")
    public ResponseResult<ArrayList<FittingProduct>> GetFittingItem(String token, String fittingId){
        ArrayList<FittingProduct> data = gtasksService.GetFittingItem(token,fittingId);
        return new ResponseResult<>(SUCCESS,data);
    }

    /**
     * 常用语
     * @param token
     * @param empId
     * @param type
     * @return
     */
    @RequestMapping("getVerbleTrickByEmpId")
    public ResponseResult<ArrayList<UsefulExpressions>> getVerbleTrickByEmpId(String token, String empId, String type){
        ArrayList<UsefulExpressions> data = gtasksService.getVerbleTrickByGuider(token,empId,type);
        return new ResponseResult<>(SUCCESS,data);
    }

    /**
     * 常用语分组
     * @param token
     * @return
     */
    @RequestMapping("getValueGroup")
    public ResponseResult<ArrayList<ValueGroup>> getValueGroup(String token){
        ArrayList<ValueGroup> data = gtasksService.getValueGroup(token);
        return new ResponseResult<>(SUCCESS,data);
    }

    /**
     * 增加常用语
     * @param token
     * @param content
     * @param type
     * @return
     */
    @RequestMapping("addPhrase")
    public ResponseResult<String> addPhrase(String token, String content, String type){
        String data = gtasksService.addPhrase(token, content, type);
        return new ResponseResult<>(SUCCESS,data);
    }

    /**
     * 修改常用语
     * @param token
     * @param id
     * @param content
     * @param type
     * @return
     */
    @RequestMapping("modifyPhrase")
    public ResponseResult<Void> modifyPhrase(String token, String id, String content, String type){
        gtasksService.modifyPhrase(token, id, content, type);
        return new ResponseResult<>(SUCCESS);
    }

    /**
     * 删除常用语
     * @param token
     * @param id
     * @return
     */
    @RequestMapping("deletePhrase")
    public ResponseResult<Void> deletePhrase(String token, String id){
        gtasksService.deletePhrase(token, id);
        return new ResponseResult<>(SUCCESS);
    }


    /**
     * 保存邀约信息
     * @param token
     * @param cardNo
     * @param type
     * @param date
     * @param inviteWay
     * @param content
     * @param feedback
     * @param remark
     * @param empId
     * @return
     */
    @RequestMapping("saveBirthdayInvite")
    public ResponseResult<Void> saveBirthdayInvite(String token, String cardNo, String type, String date, String inviteWay,
                                                   String content, String feedback, String remark, String empId,
                                                   String tarGetDate, String code){
        gtasksService.saveBirthdayInvite(token, cardNo, type, date, inviteWay, content, feedback, remark, empId,tarGetDate,code);
        return new ResponseResult<>(SUCCESS);
    }


    /**
     * 储值邀约
     * @return
     */
    @RequestMapping("GetStoreValueVip")
    public ResponseResult<BirthdayVip> GetStoreValueVip(String token, String empId, String type, int page){
        BirthdayVip data = ewStoredValueService.GetStoreValueVip(token, empId,type,page);
        return new ResponseResult<>(SUCCESS,data);
    }


    /**
     * 开卡数据
     */
    @RequestMapping("GetOpenCardTaskData")
    public ResponseResult<OpenCardTask> GetOpenCardTaskData(String token,String empId,String storeId,String type){
        OpenCardTask data = gtasksService.GetOpenCardTaskData(token, empId, storeId, type);
        return new ResponseResult<>(SUCCESS,data);
    }

    /**
     * 开卡记录
     * @param token
     * @param id
     * @param content
     * @param type
     * @param page
     * @return
     */
    @RequestMapping("GetOpenCardTaskVip")
    public ResponseResult<ArrayList<Vip> > GetOpenCardTaskVip(String token, String empId, String storeId,String type,int page){
        ArrayList<Vip>  data = gtasksService.GetOpenCardTaskVip(token, empId, storeId, type, page);
        return new ResponseResult<>(SUCCESS,data);
    }

}
